package lesson2.com.games.enums;

// implement any interfaces that you want
public enum Suit {

HEARTS("Hearts", OtherDocument.HEARTS),
CLUBS("Clubs",OtherDocument.CLUBS),
SPADES("Spades",OtherDocument.SPADES),
DIAMONDS("Diamonds", OtherDocument.DIAMONDS);

private String text;
private int otherDocumentIntegerDesignation;
private Suit(String text, int otherDocumentIntegerDesignation){
this.text=text;
this.otherDocumentIntegerDesignation=otherDocumentIntegerDesignation;
}

public int getOtherDocumentIntegerDesignation() {
return otherDocumentIntegerDesignation;
}


public String getSuitText(){
return text;
}

public static Suit getSuitByOtherDocumentIntegerDesignation(int otherDocDes){
Suit[] values = Suit.values();
for(Suit s: values){
    if(s.getOtherDocumentIntegerDesignation()==otherDocDes){
        return s;
    }
}
throw new IllegalArgumentException("Could not find Enum Suit mapped to integer "+otherDocDes);
}


}
